﻿<UserControl x:Class="BizControl.Presentation.BusinessRolesModule.Views.BusinessRolesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:csla="clr-namespace:Csla.Xaml;assembly=Csla.Xaml">
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <ToolBar>
            <Button HorizontalAlignment="Left" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
                    Width="25" Height="25" ToolTip="Обновить список"
                    Command="{Binding Path=RefreshListCommand}">
                <Button.Content>
                    <Image Source="{DynamicResource refreshImage}" />
                </Button.Content>
            </Button>
            <Button HorizontalAlignment="Left" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
                    Width="25" Height="25" ToolTip="Добавить новую роль"
                    Command="{Binding Path=AddRoleCommand}"
                    Template="{StaticResource AddButtonTemplate}">
            </Button>
        </ToolBar>
        <DataGrid Grid.Row="1" AutoGenerateColumns="False" ItemsSource="{Binding Path=Model}"
                  CanUserAddRows="True">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="Наименование роли">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBox Width="200" TextWrapping="Wrap" Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}" />
                                <csla:PropertyStatus Property="{Binding Path=Name}" />
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</UserControl>
